package com.finalProject;

import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager2.widget.ViewPager2;

import com.finalProject.R;
import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.TabLayoutMediator;

public  class FramementActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_framement);

        ViewPager2 viewPager = findViewById(R.id.viewpager);
    FragmentAdapter  pageAdapter = new FragmentAdapter(this);
        viewPager.setAdapter(pageAdapter);

        TabLayout tabLayout = (TabLayout) findViewById(R.id.sliding_tabs);
        String name [] ={"收入排行榜", "房价排行榜", "房贷计算器"};
        new TabLayoutMediator(tabLayout, viewPager,
                (tab, position) -> tab.setText(name[position])
        ).attach();




    }
}